<template>
  <div>
    <el-table :data="tableData" :show-header="false" style="width: 100%;margin-top: 15px;" height="100" :header-cell-style="headerCellStyle" :cell-style="cellStyle">
      <template slot="empty">
        <p>暂无推屏</p>
      </template>
      <el-table-column prop="id" align="center" label="序号" min-width="10%">
      </el-table-column>
      <el-table-column prop="pic" :show-overflow-tooltip="true" align="center" label="图片" min-width="20%">
        <template slot-scope="scope">
          <img :src="scope.row.pic" width="64" height="64">
        </template>
      </el-table-column>
      <el-table-column prop="name" :show-overflow-tooltip="true" align="center" label="标题" min-width="30%">
      </el-table-column>
      <el-table-column prop="couponName" :show-overflow-tooltip="true" align="center" label="优惠券" min-width="20%">
      </el-table-column>
      <el-table-column prop="isTop" :show-overflow-tooltip="true" align="center" label="状态" min-width="10%">
        <template slot-scope="scope">
          <span v-if="scope.row.isTop==0">未推送</span>
          <span v-if="scope.row.isTop==1">推送中</span>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
  export default {
    name: "liveControllerCouponsPushScreen",
    components: {
    },
    props:{
      data:{
        type: Object,
        default:()=>{}
      }
    },
    data() {
      return {
        headerCellStyle:{
          'background-color': '#f1f1f1',
          'font-size':'12px',
          'color':'#000000'
        },
        cellStyle:{
          'font-size':'12px',
          'border-bottom':'0'
        },
        tableData:[],
        parentData:null
      }
    },
    mounted: function () {
      this.parentData = this.data
      this.getData();
    },
    methods: {
      getData(){
        this.utils.request.liveRequest({
          url: '/api/v1/broadcast/coupon/list/'+this.parentData.id,
          method: 'get'
        }).then(result => {
          let data = result.data;
          if (data && data.code === '0') {
            this.tableData = data.data;
          }
        })
      },
      pushScreen(row){
        this.getData()
      }
    }
  }
</script>
<style scoped lang="scss">

</style>
